/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * InfoRestaurant.java
 *
 * Created on 24/06/2010, 01:47:26 AM
 */

package CapaGrafica;
import CapaLogica.AdministracionInterna;
import Excepciones.ObjetoNoEncontradoException;
import javax.swing.JOptionPane;
/**
 *
 * @author Maria
 */
public class InfoRestaurant extends javax.swing.JFrame {
     private ListadoRestaurants ventanaMadre;
    private String ID;
    /** Creates new form InfoRestaurant */
    public InfoRestaurant(ListadoRestaurants ventanaMadre, String ID) {
        this.ventanaMadre = ventanaMadre;
        this.ID = ID;

        boolean encontrado = true;
        String mensajeError = "<html>Error! No se pudo cargar la información del restaurant<br />";
        String[] informacion = null;
        Object[] empleados = null;

        try
        {
            informacion = AdministracionInterna.informacionRestaurant(ID).split(":");
            empleados   = AdministracionInterna.obtenerEmpleados(ID);
        }
        catch (ObjetoNoEncontradoException e)
        {
            mensajeError.concat(e.getMessage());
            JOptionPane.showMessageDialog(this, mensajeError);
        }

        if ((informacion != null) && (empleados != null))
        {
            initComponents();
            this.jLeID.setText(informacion[0]);
            this.jLnombre.setText(informacion[1]);
            this.jLeUbicacion.setText(informacion[2]);
            this.jLeHorario.setText(informacion[0]);
            this.jLeCapacidad.setText(informacion[0]);
            this.jLeSuperficie.setText(informacion[0]);
            this.jListEmpleado.setListData(empleados);
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jBmodificar = new javax.swing.JButton();
        jBregresar = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        jLid = new javax.swing.JLabel();
        jLeID = new javax.swing.JLabel();
        jLcapacidad = new javax.swing.JLabel();
        jLeCapacidad = new javax.swing.JLabel();
        jLhorario = new javax.swing.JLabel();
        jLeHorario = new javax.swing.JLabel();
        jLnombre = new javax.swing.JLabel();
        jLeNombre = new javax.swing.JLabel();
        jLsuperficie = new javax.swing.JLabel();
        jLeSuperficie = new javax.swing.JLabel();
        jLubicacion = new javax.swing.JLabel();
        jLeUbicacion = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListMenu = new javax.swing.JList();
        jScrollPane2 = new javax.swing.JScrollPane();
        jListEmpleado = new javax.swing.JList();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jBmodificar.setText("Modificar");
        jBmodificar.setName("jBmodificar"); // NOI18N

        jBregresar.setText("Regresar");
        jBregresar.setName("jBregresar"); // NOI18N

        jSeparator1.setName("jSeparator1"); // NOI18N

        jLid.setText("ID:");
        jLid.setName("jLid"); // NOI18N

        jLeID.setText("jLabel1");
        jLeID.setName("jLeID"); // NOI18N

        jLcapacidad.setText("Capacidad:");
        jLcapacidad.setName("jLcapacidad"); // NOI18N

        jLeCapacidad.setText("jLabel1");
        jLeCapacidad.setName("jLeCapacidad"); // NOI18N

        jLhorario.setText("Horario:");
        jLhorario.setName("jLhorario"); // NOI18N

        jLeHorario.setText("jLabel1");
        jLeHorario.setName("jLeHorario"); // NOI18N

        jLnombre.setText("Nombre:");
        jLnombre.setName("jLnombre"); // NOI18N

        jLeNombre.setText("jLabel1");
        jLeNombre.setName("jLeNombre"); // NOI18N

        jLsuperficie.setText("Superficie:");
        jLsuperficie.setName("jLsuperficie"); // NOI18N

        jLeSuperficie.setText("jLabel2");
        jLeSuperficie.setName("jLeSuperficie"); // NOI18N

        jLubicacion.setText("Ubicacion:");
        jLubicacion.setName("jLubicacion"); // NOI18N

        jLeUbicacion.setText("jLabel2");
        jLeUbicacion.setName("jLeUbicacion"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        jListMenu.setName("jListMenu"); // NOI18N
        jScrollPane1.setViewportView(jListMenu);

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jListEmpleado.setName("jListEmpleado"); // NOI18N
        jScrollPane2.setViewportView(jListEmpleado);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 434, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLubicacion)
                    .addComponent(jLsuperficie)
                    .addComponent(jLnombre)
                    .addComponent(jLhorario)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLid)
                            .addComponent(jLcapacidad)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(jBmodificar)))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(129, 129, 129)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLeCapacidad)
                                    .addComponent(jLeID)
                                    .addComponent(jLeHorario)
                                    .addComponent(jLeNombre)
                                    .addComponent(jLeSuperficie)
                                    .addComponent(jLeUbicacion)))
                            .addGroup(layout.createSequentialGroup()
                                .addGap(146, 146, 146)
                                .addComponent(jBregresar))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)))))
                .addGap(53, 53, 53))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(40, 40, 40)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLid)
                    .addComponent(jLeID))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLcapacidad)
                    .addComponent(jLeCapacidad))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLhorario)
                    .addComponent(jLeHorario))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLnombre)
                    .addComponent(jLeNombre))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLsuperficie)
                    .addComponent(jLeSuperficie))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLubicacion)
                    .addComponent(jLeUbicacion))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBmodificar)
                    .addComponent(jBregresar))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
    * @param args the command line arguments
    */
    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBmodificar;
    private javax.swing.JButton jBregresar;
    private javax.swing.JLabel jLcapacidad;
    private javax.swing.JLabel jLeCapacidad;
    private javax.swing.JLabel jLeHorario;
    private javax.swing.JLabel jLeID;
    private javax.swing.JLabel jLeNombre;
    private javax.swing.JLabel jLeSuperficie;
    private javax.swing.JLabel jLeUbicacion;
    private javax.swing.JLabel jLhorario;
    private javax.swing.JLabel jLid;
    private javax.swing.JList jListEmpleado;
    private javax.swing.JList jListMenu;
    private javax.swing.JLabel jLnombre;
    private javax.swing.JLabel jLsuperficie;
    private javax.swing.JLabel jLubicacion;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSeparator jSeparator1;
    // End of variables declaration//GEN-END:variables

}
